package com.cictec.middleware;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
import org.springframework.cloud.netflix.feign.EnableFeignClients;
import org.springframework.cloud.netflix.zuul.EnableZuulProxy;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.ComponentScan.Filter;
import org.springframework.context.annotation.FilterType;
import org.springframework.context.annotation.ImportResource;

import com.cictec.middleware.commons.mybatis.dao.MybatisDaoUtil;
import com.cictec.middleware.distribute.rabbitmq.TopicSender;

@SpringBootApplication
@EnableEurekaClient
@EnableFeignClients
@ImportResource(locations={"classpath:application-context.xml"})
@EnableZuulProxy
@ComponentScan(excludeFilters={@Filter(type=FilterType.ASSIGNABLE_TYPE,value=MybatisDaoUtil.class)})
public class MiddlewareDistributeApplication {

	public static Logger logger = LoggerFactory.getLogger(MiddlewareDistributeApplication.class);
	
	public static void main(String[] args) {
		ConfigurableApplicationContext context = SpringApplication.run(MiddlewareDistributeApplication.class, args);
		
		logger.debug("【middleware-distribute】服务启动成功");
		
//		TopicSender sender = (TopicSender) context.getBean("topicSender");
//		
//		for (int i = 0; i < 100; i++) {
//			sender.sendGps("gps shuj"+i);
//			try {
//				Thread.sleep(1000);
//			} catch (InterruptedException e) {
//				e.printStackTrace();
//			}
//		}
	}
}
